<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然金融中心管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">新建分支</li>
            </ol>
          </div>
        </div>
        <div class="row h-main-search">
          <form action="javascript:;" method="post">
            <div class="pull-right h-btn-group">
              <button class="btn btn-info" id="return-btn" onclick="returnIndex()"><i
                      class="fa fa-mail-reply">&nbsp;&nbsp;</i>返回
              </button>
              <@permission btnType="save" btnId="saveBtn" btnValue="创建分支" op="git:project:save"
              btnMethod="GitProjectMgr.newBranch()"/>
            </div>
          </form>
        </div>

        <div class="form-horizontal  h-form-warp">
          <div class="h-msg-title h-table-header">
            <strong>git项目分支信息</strong>
          </div>
          <form action="/gitBranch/saveGitBranch" class="form-horizontal" id="gitBranchForm"
                method="post" role="form">
            <input id="projectIds" name="projectIds" type="hidden" value="${projectIds!}"/>
            <div class="form-group">
              <label class="col-sm-2 control-label">项目编码 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="projectCodes" name="projectCodes"
                       required="required" type="text" value="${projectCodes!}"/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">基础版本分支编号 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="oldBranchCode" name="oldBranchCode" required="required"
                       type="text" value=""/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">新版本分支编号 ：</label>
              <div class="col-sm-8">
                <input class="form-control" id="newBranchCode" name="newBranchCode" required="required"
                       type="text" value=""/>
              </div>
              <div class="col-sm-1">
                <span class="required">*</span>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->
</div>

<#include "/common/jslib.html">
<!-- 弹窗下拉 -->
<script type="text/javascript">
    function returnIndex() {
        window.location.href = "/gitBranch/query";
    }

    $(function () {
        // 页面操作类型：add(添加)-edit(编辑)-view(查看)
        var operation = $("#operation").val();
        // 弹出窗体控制
        GitBranchMgr = {
            // 初始化
            init: function () {
                // 查看的时候不显示保存按钮
                if (operation == "view") {
                    Jmts.setFormReadOnly();
                }
            },
            // init end

            // 提交数据
            newBranch: function () {
                Jmts.ajaxSubmit(document.getElementById("gitBranchForm"), function (result) {
                    if (result.success) {
                        if (operation == 'add') {
                            GitBranchMgr.returnIndex();
                        } else {
                            Jmts.succTips(result.msg);
                            window.location.reload();
                        }
                    } else {
                        Jmts.warnTips(result.msg);
                    }
                });
                return false;
            },
            // submitForm end
            returnIndex: function () {
                window.location.href = "/gitBranch/query";
            },
        };
        // 执行初始化
        GitBranchMgr.init();
        // 前台验证表单
        $("#gitBranchForm").validate();
    });
</script>
</body>
</html>
